package com.sushi.controller;

import com.sushi.service.TagService;
import com.sushi.response.ResponseBO;
import com.sushi.response.ResponsePageBO;
import com.sushi.response.TagResp;
import com.sushi.request.TagReq;
import com.sushi.request.TagPageReq;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;
import org.springframework.beans.factory.annotation.*;

import java.util.List;

/**
 * 标签 控制器
 * @date 2023-05-02
 * @time 17:15:59
 * @author Administrator
 */
@RestController
@Slf4j
public class TagController {

	@Autowired
	private TagService tagService;

    

    /**
     * 新增
     */
    @PostMapping("/tag/add")
    public ResponseBO<TagResp> add(@RequestBody TagReq req) {
        return tagService.add(req);
    }

    /**
     * 逻辑删除
     */
    @PostMapping("/tag/remove")
    public ResponseBO<TagResp> remove(@RequestBody TagReq req) {
        return tagService.logicRemove(req);
    }

    /**
     * 更新
     */
    @PostMapping("/tag/update")
    public ResponseBO<TagResp> update(@RequestBody TagReq req) {
        return tagService.updateByField(req);
    }

    /**
     * 列表
     */
    @PostMapping("/tag/list")
    public ResponsePageBO<TagResp> list(@RequestBody TagPageReq req) {
        return tagService.listByCondition(req);
    }

    /**
     * 详情
     */
    @PostMapping("/tag/detail")
    public ResponseBO<TagResp> detail(@RequestBody TagReq req) {
        return tagService.detail(req);
    };

    @PostMapping("/tag/listByType")
    public ResponseBO<List<TagResp>> listByType(@RequestBody TagReq req) {
        return tagService.listByType(req);
    }

}